package ru.ipo.dces.server;

import ru.ipo.dces.clientservercommunication.*;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: oleg
 * Date: 22.06.11
 * Time: 22:08
 */
public final class RequestResponseMapping {

    private static Map<Class<? extends Request>, Class<? extends Response>> mapping = new HashMap<Class<? extends Request>, Class<? extends Response>>();

    static {
        mapping.put(AvailableContestsRequest.class, AvailableContestsResponse.class);
        mapping.put(UpdateContestDataRequest.class, AcceptedResponse.class);
        mapping.put(AdjustContestRequest.class, AdjustContestResponse.class);
        mapping.put(ConnectToContestRequest.class, ConnectToContestResponse.class);
        mapping.put(CreateContestRequest.class, CreateContestResponse.class);
        mapping.put(DisconnectRequest.class, AcceptedResponse.class);
        mapping.put(GetContestDataRequest.class, GetContestDataResponse.class);
        mapping.put(GetUsersRequest.class, GetUsersResponse.class);
        mapping.put(DownloadPluginRequest.class, DownloadPluginResponse.class);
        mapping.put(RegisterToContestRequest.class, AcceptedResponse.class);
        mapping.put(RemovePluginRequest.class, AcceptedResponse.class);
        mapping.put(RestorePasswordRequest.class, AcceptedResponse.class);
        mapping.put(SubmitSolutionRequest.class, SubmitSolutionResponse.class);
        mapping.put(CreateDataBaseRequest.class, AcceptedResponse.class);
        mapping.put(RemoveUserRequest.class, AcceptedResponse.class);
        mapping.put(RemoveContestRequest.class, AcceptedResponse.class);
        mapping.put(AdjustPluginRequest.class, AcceptedResponse.class);
        mapping.put(GetContestResultsRequest.class, GetContestResultsResponse.class);
        mapping.put(StopContestRequest.class, AcceptedResponse.class);
        mapping.put(AvailablePluginsRequest.class, AvailablePluginsResponse.class);
        mapping.put(CheckerRequest.class, AcceptedResponse.class);
        mapping.put(GetUserHistoryRequest.class, GetUserHistoryResponse.class);
    }

    private RequestResponseMapping() {}

    public static Class<? extends Response> getResponseClass(Class<? extends Request> requestClass) {
        return mapping.get(requestClass);
    }

}
